home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / teco.zip / SEARCH.C < prev    next >
C/C++ Source or Header  |  1986-07-15  |  655b  |  26 lines

  1. #include <ctype.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. search() /* Search for (alt terminated) string */
  5. {
  6. #include "teco.h"
  7.  
  8.     int match=0;                /* Comparison cnt */
  9.     int tmp;                /* Scratch var #1 */
  10.  
  11.     bufptx++;                /* Advance to nxt */
  12.  
  13.     if (getbuf[getptx] == 27) goto done;    /* Found string   */
  14.     while (bufptx <= bufptr ) {        /* Scan the array */
  15.     if (toupper(buffer[bufptx+match]) != toupper(getbuf[getptx+match])) {
  16.             bufptx++;        /* Punt, no match */
  17.             match=0;        /*  ..reset count */
  18.         } else {
  19.             match++;        /* Record a match */
  20.             if (getbuf[getptx+match] == 27) goto done;
  21.         }
  22.     }
  23.     bufptx=0;                /* Pointer to beg */
  24. done:;
  25. }
  26.